﻿using NBuild.Fx.Interfaces;

namespace NBuild.Fx
{
    public abstract class TaskSet : ITaskSet
    {
        private readonly IBuildEngine _engine;
        private readonly IBuildScript _script;

        protected TaskSet(IBuildEngine engine, IBuildScript script)
        {
            _engine = engine;
            _script = script;
        }

        public virtual bool IsReusable
        {
            get { return true; }
        }

        #region Log methods

        protected void Log(LogType logType, object message, params object[] args)
        {
            Script.Log(logType, message, args);
        }

        #endregion

        #region Protected properties

        protected BuildEnvironment BuildEnvironment
        {
            get { return Engine.BuildEnvironment; }
        }

        protected IBuildEngine Engine
        {
            get { return _engine; }
        }

        protected IBuildScript Script
        {
            get { return _script; }
        }

        #endregion
    }
}
